package week9.q3;

public class CarShop {
    private double money=0;


    public void sellCar(Car car) {
        money += car.getPrice();
        System.out.println("卖出一辆"+car.getName()+","+"单价"+car.getPrice()+"万元");
    }

    public void sellCars(Car car,int count) {

        if (count<=0) {
            System.out.println("销售额必须为正数");
            return;
        }
        double total =car.getPrice()*count;
        money += total;
        System.out.println("卖出"+count+"辆"+car.getName()+" ,单价" + car.getPrice() + "万元，合计" + total + "万元");

    }

    public double getTotalPrice() {
        return money;
    }

}
